R00=000000bc R04=08c9c9c8 R08=00000000 R12=020217cc
R01=08c9a200 R05=00000009 R09=00000000 R13=03007d5c
R02=08b92eb0 R06=00000000 R10=00000000 R14=080315c5
R03=00000000 R07=03007dd8 R11=03007dfc R15=080315ca
R00=EvntPointer from byte 120 of chapter data
080315c8  0080 lsl r0, r0, #0x02
080315ca  1900 add r0, r0, r4
080315cc  6800 ldr r0, [r0, #0x0]
R00=08ca6404
080315ce  bc10 pop {r4}
R04=0000000b (R04/R05=X/Y pos of village tile)
bx r1 R01=8078c31
08078c30  6880 ldr r0, [r0, #0x8]
R00=08ca6354
08078c32  9000 str r0, [sp, #0x0]
popped into r0 at 807814e
08078150  8805 ldrh r5, [r0, #0x0]
R05=00000006
08078152  8840 ldrh r0, [r0, #0x2]
R00=00000008
08078154  f001 bl $080798f8
blah blah
08079904  f7ff bl $08079798
copy r0 to r3
subtract 1
080797a0  4909 ldr r1, [$080797c8] (=$03004ad8)
copy r3 back to r0
shift right 3 bits
add to r1 and store into r2
080797ae  4907 ldr r1, [$080797cc] (=$08c9eaec)
shift r0 left 3 bits and subtract from r3 into r0
080797b4  1840 add r0, r0, r1
080797b6  7812 ldrb r2, [r2, #0x0]
R02=00000083
080797b8  7800 ldrb r0, [r0, #0x0]
R00=00000080
080797ba  4002 and r2, r0
copy r2 to r0
Bit check
If bit is set,
08078140  00e8 lsl r0, r5, #0x03
R00=00000030
08078142  19c0 add r0, r0, r7
R00=08c9e9d8
08078144  6801 ldr r1, [r0, #0x0]
R01=00000003
08078146  0089 lsl r1, r1, #0x02
08078148  6820 ldr r0, [r4, #0x0]
R00=08ca6354
0807814a  1840 add r0, r0, r1
R00=08ca6360
0807814c  6020 str r0, [r4, #0x0]
R04=03007d64
popped into r0
0807814a  1840 add r0, r0, r1 R01=0000000c
R00=08ca636c
0807814c  6020 str r0, [r4, #0x0]
R04=03007d64
popped into r4
080784c6  68a1 ldr r1, [r4, #0x8]
R01=000e090b - type, Y, X

R00=0000000e R04=0000000b R08=00000000 R12=020217cc
R01=08078c3f R05=00000009 R09=00000000 R13=03007d64
R02=0000000b R06=00000000 R10=00000000 R14=08078515
R03=03007d64 R07=03007dd8 R11=03007dfc R15=08078c4e
CPSR=8000003f (N.....T Mode: 1f)
08078c4c  0080 lsl r0, r0, #0x02
08078c4e  4903 ldr r1, [$08078c5c] (=$08078c60)
08078c50  1840 add r0, r0, r1
08078c52  6800 ldr r0, [r0, #0x0]
08078c54  4687 mov pc, r0

Where R00 is equal to the byte that is directly after the X, Y position of the village, and is used to determine whether the village is a visitable village, a shop, an armory, etc.
(R04/R02=X coord and R05=Y coord)

0x00 - 08078df0 - ????

0x01 - 08078df2 - ????

0x02 - 08078df2 - Same as previous

0x03 - 08078df2 - Same as previous

0x04 - 08078df2 - Same as previous

0x05 - 08078df2 - Same as previous

0x06 - 08078df2 - Same as previous

0x07 - 08078df2 - Same as previous

0x08 - 08078df2 - Same as previous

0x09 - 08078df2 - Same as previous

0x0a - 08078df2 - Same as previous

0x0b - 08078df2 - Same as previous

0x0c - 08078df2 - Same as previous

0x0d - 08078df2 - Same as previous

0x0e - 08078cd8 - Village routine start

0x0f - 08078cd8 - Sieze

0x10 - 08078d08 - A different village?

0x11 - 08078d08 - Same as previous

0x12 - 08078d3a - Chest

0x13 - 08078dbc - Armory routine start

0x14 - 08078dcc - Shop routine start

0x15 - 08078ddc - Secret shop routine start

0x16 - 08078dec - ????

0x17 - 08078df2 - ????

0x18 - 08078df2 - Same as previous

0x19 - 08078df2 - Same as previous

0x1a - 08078df2 - Same as previous

0x1b - 08078df2 - Same as previous

0x1c - 08078df2 - Same as previous

0x1d - 08078ce6 - ????

~End~

080784c0 - X, Y pos load routine start

08078c4c - Village routine selector

X, Y of village stored at 08ca6374

0800d976  8881 ldrh r1, [r0, #0x4] R00=08cbec54

0800d97c

0800d9da

0800d9e4

0800ef5e

0800ef74

080044fa

Breakpoint (on write) address 03007d84 old:000036bb new:0000007f
R00=08b91dc4 R04=0202bd50 R08=08b90e4c R12=00000001
R01=020250b0 R05=0000007f R09=00000000 R13=03007d80
R02=020250b0 R06=02025106 R10=00000000 R14=080044ff
R03=0202bd50 R07=08b90e48 R11=03007dfc R15=08004498
CPSR=0000003f (......T Mode: 1f)
08004496  1c04 add r4, r0, #0x0

bpw 3007d84 1

R00=080044e5 R04=08b91dc4 R08=08b90e4c R12=00000001
R01=020253a4 R05=020253a4 R09=00000000 R13=03007d80
R02=00000000 R06=020250b0 R10=00000000 R14=08004bc1
R03=00000002 R07=08b90e48 R11=03007dfc R15=08004bce
08004bca  4700 bx r0

080044e4  1c29 add r1, r5, #0x0
080044e6  3127 add r1, #0x27
080044e8  20f7 mov r0, #0xf7
080044ea  780a ldrb r2, [r1, #0x0]
080044ec  4010 and r0, r2
080044ee  7008 strb r0, [r1, #0x0]
080044f0  1c28 add r0, r5, #0x0
080044f2  bc70 pop {r4-r6}
080044f4  bc02 pop {r1}
080044f6  4708 bx r1

0800451e

08004524

0800ef7a

0800efb0

0800efb6  6da0 ldr r0, [r4, #0x58] R04=020253a4
Loads item number of item rewarded for village visit

String view:

00 0c 00 07 / 00 00 00 4c / 00 12 02 19
word 1
byte 1, 2, 3 - ????
byte 4 - pointer to next event data
word 2 - item ID # for reward
word 3
halfword 1 - Village/Shop/Chest ID byte
halfword 2 - X, Y position of chest

Take map event pointer from 120th byte of chapter entry from chapter data

Multiply by 4

Add to c9c9c8

Take the pointer at the address you get and add 8 to that

Go to that address and add 4 to the pointer you find there***

Go to that address and you should find the item # of whatever is inside of chest 0

Change it to something else and open chests until you find one that has your new item in it

That will be chest 0

***If you DON'T add 4 to this number, you can go to the address you have, and here:

Take the first byte

Multiply that byte by 8

Add result to c9e9a8

Go to the resulting address

Take the word (4 bytes) and multiply it by 4

Add the result to the number you had at "***"

Adding 4 to THIS number will give you the pointer to the next chest.

Treasure chest item routine

0802cb3c  5745 ldrh r5, [r0, r5]
0802cb3e  7b20 ldrb r0, [r4, #0xc]
0802cb40  f7ec bl $08018d0c
0802cb44  2411 mov r4, #0x11
0802cb46  5704 ldrh r4, [r0, r4]
0802cb48  1e68 sub r0, r5, #0x1
0802cb4a  0600 lsl r0, r0, #0x18
0802cb4c  1600 asr r0, r0, #0x18
0802cb4e  1c21 add r1, r4, #0x0
0802cb50  f04c bl $08078f40
0802cb54  1c68 add r0, r5, #0x1
0802cb56  0600 lsl r0, r0, #0x18
0802cb58  1600 asr r0, r0, #0x18
0802cb5a  1c21 add r1, r4, #0x0
0802cb5c  f04c bl $08078f40
0802cb60  1e61 sub r1, r4, #0x1
0802cb62  0609 lsl r1, r1, #0x18
0802cb64  1609 asr r1, r1, #0x18
0802cb66  1c28 add r0, r5, #0x0
0802cb68  f04c bl $08078f40
0802cb6c  1c61 add r1, r4, #0x1
0802cb6e  0609 lsl r1, r1, #0x18
0802cb70  1609 asr r1, r1, #0x18
0802cb72  1c28 add r0, r5, #0x0
0802cb74  f04c bl $08078f40
0802cb78  1c28 add r0, r5, #0x0
0802cb7a  1c21 add r1, r4, #0x0
0802cb7c  f04c bl $08078efc
0802cb80  4808 ldr r0, [$0802cba4] (=$0202bbf8)
0802cb82  3041 add r0, #0x41
0802cb84  7800 ldrb r0, [r0, #0x0]
0802cb86  0780 lsl r0, r0, #0x1e
0802cb88  2800 cmp r0, #0x0
0802cb8a  db02 blt $0802cb92
0802cb8c  20b1 mov r0, #0xb1
0802cb8e  f091 bl $080be594
0802cb92  4805 ldr r0, [$0802cba8] (=$0203a470)
0802cb94  306f add r0, #0x6f
0802cb96  21ff mov r1, #0xff

X position load
0802cb3c

R00=0202bde0 R04=0203a85c
CPSR=0000003f (......T Mode: 1f)
0802cb3e  7b20 ldrb r0, [r4, #0xc]

R00=00000003
0802cb40  f7ec bl $08018d0c

R00=00000003
08018d0c  4a03 ldr r2, [$08018d1c] (=$08b92eb0)

R00=00000003
R02=08b92eb0
08018d0e  21ff mov r1, #0xff

R00=00000003
R01=000000ff
R02=08b92eb0
08018d10  4001 and r1, r0

R01=00000003
R02=08b92eb0
08018d12  0089 lsl r1, r1, #0x02

R01=0000000c
R02=08b92eb0
08018d14  1889 add r1, r1, r2

R01=08b92ebc
08018d16  6808 ldr r0, [r1, #0x0]

R00=0202bde0
R14=0802cb45
08018d18  4770 bx lr

R00=0202bde0
0802cb44  2411 mov r4, #0x11

Y position load
R00=0202bde0 R04=00000011
0802cb46  5704 ldrh r4, [r0, r4]

R04=00000001
R05=00000018
0802cb48  1e68 sub r0, r5, #0x1

[Useless shifting]

R00=00000017 R04=00000001
0802cb4e  1c21 add r1, r4, #0x0

R00=00000017 R04=00000001
R01=00000001
0802cb50  f04c bl $08078f40

R00=00000017 R04=00000001
R01=00000001 R05=00000018 R13=03007d80
R14=0802cb55
08078f40  b530 push {r4,r5,lr}

R00=00000017 R04=00000001
R01=00000001 R05=00000018 R13=03007d74
08078f42  0600 lsl r0, r0, #0x18

R00=17000000 R04=00000001
R01=00000001 R05=00000018
08078f44  1605 asr r5, r0, #0x18

R00=17000000 R04=00000001
R01=00000001 R05=00000017
08078f46  0609 lsl r1, r1, #0x18

R00=17000000 R04=00000001
R01=01000000 R05=00000017
08078f48  160c asr r4, r1, #0x18

R00=17000000 R04=00000001
R01=01000000 R05=00000017
08078f4a  1c28 add r0, r5, #0x0

R00=00000017 R04=00000001
R01=01000000 R05=00000017
08078f4c  1c21 add r1, r4, #0x0

R00=00000017 R04=00000001
R01=00000001 R05=00000017
08078f4e  f7ff bl $08078f24

R00=00000017 R04=00000001
R01=00000001 R05=00000017
R14=08078f53
08078f24  b500 push {lr}

[More useless shifting]

R00=00000017 R04=00000001
R01=00000001 R05=00000017 R13=03007d70
08078f2e  f7ff bl $08078bd0

R00=00000017 R04=00000001
R01=00000001 R05=00000017
R14=08078f33
08078bd0  b530 push {r4,r5,lr}

R00=00000017 R04=00000001
R01=00000001 R05=00000017 R13=03007d64
08078bd2  b087 add sp, -#0x1c

R00=00000017
R01=00000001 R13=03007d48
08078bd4  1c04 add r4, r0, #0x0

R00=00000017 R04=00000017
R01=00000001
08078bd6  1c0d add r5, r1, #0x0

[Still more useless shifting]

R00=00000017 R04=00000017
R01=00000001 R05=00000001
08078be0  4808 ldr r0, [$08078c04] (=$0202bbf8)

R00=0202bbf8 R04=00000017
 R05=00000001
08078be2  7b80 ldrb r0, [r0, #0xe]

[Even more useless shifting]

R00=00000026 R04=00000017 
R05=00000001
08078be8  f7b8 bl $080315bc

R00=Chapter#

R00=00000026 R04=00000017
R05=00000001
R14=08078bed
080315bc  b510 push {r4,lr}

R00=00000026 R04=00000017 
R05=00000001 R13=03007d40
080315be  4c05 ldr r4, [$080315d4] (=$08c9c9c8)

R00=00000026 R04=Ch Pntrs
080315c0  f7ff bl $08031574

R00=00000026 R04=08c9c9c8
08031574  2198 mov r1, #0x98

R00=00000026 R04=08c9c9c8
R01=00000098
08031576  4348 mul r0, r1

R00=00001690 R04=08c9c9c8
08031578  4901 ldr r1, [$08031580] (=$08c9a200)

R00=00001690 R04=08c9c9c8
R01=ChDatBase
0803157a  1840 add r0, r0, r1

R00=08c9b890 R04=08c9c9c8
R14=080315c5
0803157c  4770 bx lr

R00=08c9b890 R04=08c9c9c8
080315c4  3078 add r0, #0x78

R00=08c9b908 R04=08c9c9c8
080315c6  7800 ldrb r0, [r0, #0x0]

R00=EvntPntr R04=08c9c9c8
080315c8  0080 lsl r0, r0, #0x02

R00=0000028c R04=08c9c9c8
080315ca  1900 add r0, r0, r4

R00=08c9cc54
080315cc  6800 ldr r0, [r0, #0x0]

R00=08ca593c R04=08c9c9c8
R01=08c9a200 R05=00000001 R13=03007d40
R02=08b92eb0 R06=00000000
R03=00000002 R07=03007dd8
080315ce  bc10 pop {r4}

R00=08ca593c R04=00000017
R01=08c9a200 R05=00000001 R13=03007d44
R02=08b92eb0 R06=00000000
R03=00000002 R07=03007dd8
080315d0  bc02 pop {r1}

R00=08ca593c R04=00000017
R01=08078bed R05=00000001
R02=08b92eb0 R06=00000000
R03=00000002 R07=03007dd8
080315d2  4708 bx r1

R00=08ca593c
08078bec  6880 ldr r0, [r0, #0x8]

R00=08ca58ec
R13=03007d48
08078bee  9000 str r0, [sp, #0x0]

08078bf0  4668 mov r0, sp

R00=03007d48 R04=00000017
R05=00000001
08078bf2  7604 strb r4, [r0, #0x18]
08078bf4  7645 strb r5, [r0, #0x19]
08078bf6  f7ff bl $0807812c

R00=03007d48 R04=00000017
R05=00000001 R13=03007d48
R06=00000000 R14=08078bfb
R07=03007dd8
0807812c  b5f0 push {r4-r7,lr}
0807812e  1c04 add r4, r0, #0x0
08078130  2000 mov r0, #0x0

R00=00000000 R04=03007d48
08078132  6060 str r0, [r4, #0x4]
08078134  60a0 str r0, [r4, #0x8]

08078136  4e01 ldr r6, [$0807813c] (=$08c9e9a4)
08078138  1d37 add r7, r6, #0x4
0807813a  e008 b $0807814e

R01=08078521
080bfc50  4708 bx r1

R00=03007d48 R04=03007d48
R01=08078521 R05=00000007
R02=00000000 R06=08c9e9a4 R14=0807816b
R03=00000009 R07=08c9e9a8
CPSR=0000003f (......T Mode: 1f)
08078520  b570 push {r4-r6,lr}

08078522  1c02 add r2, r0, #0x0
R02=03007d48

08078524  6813 ldr r3, [r2, #0x0]
R03=08ca58ec (aka Item#Addr-4)

08078526  6898 ldr r0, [r3, #0x8]
R00=00120017

08078528  21ff mov r1, #0xff
0807852a  0209 lsl r1, r1, #0x08
0807852c  4001 and r1, r0
0807852e  0a0c lsr r4, r1, #0x08
08078530  21ff mov r1, #0xff
08078532  0409 lsl r1, r1, #0x10
08078534  4001 and r1, r0
08078536  0c0d lsr r5, r1, #0x10
08078538  0e01 lsr r1, r0, #0x18
0807853a  7a18 ldrb r0, [r3, #0x8]
R00=00000017 R04=00000000  4  3
R01=00000000 R05=00000012  1  2

0807853c  7e16 ldrb r6, [r2, #0x18] R02=03007d48
R06=00000017 - Character X position

R00=00000017 - Chest X position
R06=00000018
0807853e  42b0 cmp r0, r6
08078540  d10f bne $08078562

08078542  2019 mov r0, #0x19
08078544  5610 ldrh r0, [r2, r0] - load character Y position
08078546  4284 cmp r4, r0 - compare char y pos to chest y pos
08078548  d10b bne $08078562

Here is the code executed when the chest matching the character's position is found
0807854a  2001 mov r0, #0x1
0807854c  6050 str r0, [r2, #0x4] R02=03007d48
0807854e  8858 ldrh r0, [r3, #0x2] R03=08ca58f8
08078550  6090 str r0, [r2, #0x8] R00=0000000b
08078552  60d5 str r5, [r2, #0xc] R05=00000012
08078554  6111 str r1, [r2, #0x10] R01=00000000
[ITEM # LOAD]

08078562  2000 mov r0, #0x0 <----------------------------
							|
08078564  bc70 pop {r4-r6}				|
							|
R00=00000000 R04=03007d4c				|
R05=00000007 <- Used for loading next chest		|
R06=08c9e9a4						|
08078566  bc02 pop {r1}					|
							|
R00=00000000 R04=03007d4c				|
R01=0807816b R05=00000007				|
R06=08c9e9a4						|
08078568  4708 bx r1					|
							|
R00=00000000 R04=03007d4c				|
R05=00000007						|
R06=08c9e9a4						|
0807816a  2801 cmp r0, #0x1 <----------------------------
0807816c  d1e8 bne $08078140

R00=00000000 R04=03007d4c
R01=0807816b R05=00000007
R07=08c9e9a8
08078140  00e8 lsl r0, r5, #0x03

R00=00000038 R04=03007d4c
R01=0807816b R05=00000007
R07=08c9e9a8
08078142  19c0 add r0, r0, r7

R00=08c9e9e0 R04=03007d4c
R01=0807816b R05=00000007
R07=08c9e9a8
08078144  6801 ldr r1, [r0, #0x0]

R00=08c9e9e0 R04=03007d4c
R01=00000003
08078146  0089 lsl r1, r1, #0x02

R00=08c9e9e0 R04=03007d4c
R01=0000000c
08078148  6820 ldr r0, [r4, #0x0]

R00=08ca58ec R04=03007d4c
R01=0000000c
0807814a  1840 add r0, r0, r1

R00=08ca58f8 R04=03007d4c
0807814c  6020 str r0, [r4, #0x0]

R00=08ca58f8 R04=03007d48
0807814e  6820 ldr r0, [r4, #0x0]

R00=08ca58f8
08078150  8805 ldrh r5, [r0, #0x0]

R00=08ca58f8
R05=00000007 <- Number used for loading next chest?
08078152  8840 ldrh r0, [r0, #0x2]

R00=0000000b
R05=00000007
08078154  f001 bl $080798f8

08078158  0600 lsl r0, r0, #0x18
0807815a  2800 cmp r0, #0x0
0807815c  d1f0 bne $08078140
0807815e  00e8 lsl r0, r5, #0x03 <- Loading next chest
08078160  1980 add r0, r0, r6
08078162  6801 ldr r1, [r0, #0x0]
08078164  1c20 add r0, r4, #0x0
08078166  f047 bl $080bfc50

080798f8  b500 push {lr}
080798fa  2863 cmp r0, #0x63
080798fc  dd02 ble $08079904

08079904  f7ff bl $08079798
08079908  0600 lsl r0, r0, #0x18
0807990a  1600 asr r0, r0, #0x18
0807990c  bc02 pop {r1}
0807990e  4708 bx r1 R01=08078159

08079798  1c03 add r3, r0, #0x0
0807979a  2b00 cmp r3, #0x0
0807979c  d011 beq $080797c2
0807979e  3b01 sub r3, #0x1
080797a0  4909 ldr r1, [$080797c8] (=$03004ad8)
080797a2  1c18 add r0, r3, #0x0
080797a4  2b00 cmp r3, #0x0
080797a6  da00 bge $080797aa

080797aa  10c0 asr r0, r0, #0x03
080797ac  1842 add r2, r0, r1
080797ae  4907 ldr r1, [$080797cc] (=$08c9eaec)
080797b0  00c0 lsl r0, r0, #0x03
080797b2  1a18 sub r0, r3, r0
080797b4  1840 add r0, r0, r1
080797b6  7812 ldrb r2, [r2, #0x0]
080797b8  7800 ldrb r0, [r0, #0x0]
080797ba  4002 and r2, r0
080797bc  1c10 add r0, r2, #0x0
080797be  2800 cmp r0, #0x0
080797c0  d106 bne $080797d0
080797c2  2000 mov r0, #0x0
080797c4  e005 b $080797d2

080797d2  4770 bx lr R14=08079909

08078556  8898 ldrh r0, [r3, #0x4] R03=Item#Addr-4
08078558  6150 str r0, [r2, #0x14] R02=03007d4c

08078d3a  9c05 ldr r4, [sp, #0x14] R13=03007d4c

0802bd0c  b570 push {r4-r6,lr}

bpw 3007d3c 1 00000048

0800af74  b5f0 push {r4-r7,lr}

bpw 3007d28 1 00000048

R00=02025250
R01=00000000
0800d9e0  8801 ldrh r1, [r0, #0x0] =$48 (Item #)

0800d97c  f000 bl $0800d9d0
Item # not loaded yet
0800d9e4  f001 bl $0800ef54
Item # in r5
0800ef5e  d807 bhi $0800ef70

0800ef74  f7f5 bl $080044f8

080044fa  f7ff bl $08004494

08004494  b570 push {r4-r6,lr}

bpw 3007d84 1 00000048

080044f2  bc70 pop {r4-r6}

R04=0202bde0
R05=00000048
R06=0202524a
080044f4  bc02 pop {r1}

R01=0800ef79
08004524  4708 bx r1

Where r5 is item #